<!DOCTYPE html>  
<html xmlns="http://www.w3.org/1999/xhtml">  
    <head>  
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />  
        <title></title>  
        <script src="../src/ol-debug.js"></script>  
        <link href="../src/ol.css" rel="stylesheet" />  
        <script type="text/javascript">
            window.onload = function () {
                var googleMapLayer = new ol.layer.Tile({
                    source: new ol.source.XYZ({
                        coorOffset: {X: 605, Y: 443},
                        //url: 'http://www.google.cn/maps/vt/pb=!1m4!1m3!1i{z}!2i{x}!3i{y}!2m3!1e0!2sm!3i380072576!3m8!2szh-CN!3scn!5e1105!12m4!1e68!2m2!1sset!2sRoadmap!4e0!5m1!1e0'  
                        url: 'http://mt3.google.cn/maps/vt?lyrs=s%40794&hl=zh-CN&gl=CN&x={x}&y={y}&z={z}'
                    })

    //              source:  new ol.source.XYZ({
    //              	offsetX:605,offsetY:443,
    //               tileUrlFunction: function (coordinate) {
    //                console.log(coordinate[0] + " X= " + coordinate[1] + " Y= " + coordinate[2]);
    //                var x = parseInt(coordinate[1]);
    //                var y = Math.abs(parseInt(coordinate[2]))-1;
    //                var z = parseInt(coordinate[0]);
    //                //return '_alllayers/' + z + '/' + y + '/' + x + '.jpg';//这里可以修改地图路径
    ////                return 'http://www.google.cn/maps/vt/pb=!1m4!1m3!1i'+z
    ////                +'!2i'+x+'!3i'+y
    ////                +'!2m3!1e0!2sm!3i380072576!3m8!2szh-CN!3scn!5e1105!12m4!1e68!2m2!1sset!2sRoadmap!4e0!5m1!1e0'  
    //                var timestamp = Date.parse(new Date());
    //                var s=timestamp % 4;
    //                return 'http://mt'+s+'.google.cn/maps/vt?lyrs=s%40794&hl=zh-CN&gl=CN&x='+x+'&y='+y+'&z='+z;
    //            }
    //          })
                });



                var map = new ol.Map({
                    layers: [googleMapLayer],
                    view: new ol.View({
                        center: [112.9324919220994, 28.16391954413889],
                        projection: 'EPSG:4326', // 'EPSG:3857',// 
                        zoom: 16
                    }),
                    target: 'map'
                });
                
                 var vect = new ol.layer.Vector({
                    source: new ol.source.Vector({
                        url: 'csu/doc.kml',
                        format: new ol.format.KML()
                    })
                });

                map.addLayer(vect);

//                var vector = new ol.layer.Vector({
//                    source: new ol.source.Vector({
//                        url: 'test.kml',
//                        format: new ol.format.KML()
//                    })
//                });
//
//                map.addLayer(vector);
            };
        </script>  
    </head>  
    <body>  
        <div id="map" style='width:99%;height:99%'></div>  
    </body>  
</html>  